#coding=utf-8

import numpy as np
import matplotlib.pyplot as plt

nstep = 50
xa = 0; xb = 1000
x = [0]; y=[xb]
for i in range(nstep):
    b2a = xb
    for j in range(xa):
        if np.random.random() < 0.5:
            b2a -=1
    xb -= b2a; xa += b2a
    x.append(i+1); y.append(xb)
plt.plot(x,y)
plt.xlabel("Steps",fontsize=15)
plt.ylabel("# of walkers at $x=1$", fontsize=15)
plt.savefig("../../../doc/marp-slides/constrain.random.walk.png")
plt.show()

